package com.sensen.mapper;

import com.sensen.model.User;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

/**
 * Created by Administrator on 2017/10/3.
 */
public class UserSqlProvider {

    public String selectSelective(User record){
        BEGIN();

        SELECT("p_id, p_name, p_age");
        FROM("person");
        WHERE("1=1");

        if(record.getStartAge()!=null){
            AND();
            WHERE("p_age >= #{startAge}");
        }

        if(record.getEndAge()!=null){
            AND();
            WHERE("p_age <= #{endAge}");
        }


        return SQL();
    }
}
